package com.bsj.sipgateway.sip.auth;

import com.bsj.power.common.def.entity.gb28181.Device;
import com.bsj.sipgateway.sip.transmit.cmd.impl.SIPCommander;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**    
 * @Description:注册逻辑处理，当设备注册后触发逻辑。
 * @author bsj-chenjunkang
 * @date 2022/8/31
 */
@Slf4j
@Component
public class RegisterLogicHandler {

	@Autowired
	private SIPCommander cmder;
	
	public void onRegister(Device device, int expires) {
		// TODO 后续处理，只有第一次注册时调用查询设备信息，如需更新调用更新API接口
		//cmder.deviceInfoQuery(device);
		
		cmder.catalogQuery(device);
		log.info("设备注册成功，发送catalog消息准备初始化设备通道信息");

		cmder.mobilePositionSubscribe(device, expires, 30);
	}
}
